package org.example.java8.date;

import java.time.Duration;
import java.time.Instant;
import java.time.LocalTime;

public class InstantTest {
    public static void main(String[] args) throws InterruptedException {
        Instant start = Instant.now();
        Thread.sleep(1000L);
        Instant end = Instant.now();
        Duration duration = Duration.between(start, end);
        System.out.println(duration.toMillis());

        //Duration
        LocalTime time = LocalTime.now();
        LocalTime beforeTime = time.minusHours(1);
        Duration duration1 = Duration.between(time, beforeTime);
        System.out.println(duration1.toHours());

    }
}
